import type {
    ILoginData,
    IUserInfo,
    IUserInfoResult,
    IUserMenuItem,
    IUserMenuItemResult
} from "@/services/modules/login/type";
import { request } from "@/services";

export function userLogin(loginData: ILoginData) {
  return request.post({
    url: "/login",
    // data 是请求体 params 是 url 参数
    data: loginData
  });
}

export function getUserInfoById(id: number): Promise<IUserInfoResult> {
  return request.get({
    url: `/users/${id}`
  });
}

export function getUserMenusByRoleId(id: number): Promise<IUserMenuItemResult> {
  return request.get({
    url: `/role/${id}/menu`
  });
}
